// Analysis 
import delimited "main.csv", clear varname(1)
set scheme plottig // setting graphical scheme

gen what1 = (what-6)*(-1) // Reclassify what to use "no comment" as reference
drop what
rename what1 what

********************************************************************************
***** Figure 3 *****************************************************************
********************************************************************************


// Combined analysis first

reg appb i.what, robust
	margins i.what, vsquish post
	estimates store approve
	
quietly reg pun2b i.what, cluster(id)
	margins i.what, vsquish post
	estimates store punish
	
** Approval
coefplot approve, ciopts(recast(rcap)) rescale(100) format(%9.0f) mlabpos(1) ///
		 ylabel(1 `""Recent" "Whataboutism" "' 2 `""Past" "Whataboutism" "' ///
				3 `""Unrelated" "Whataboutism" "' 4 "Denial" 5 "No comment", ///
				labcol(black)) name(g1, replace) ///
		 ytitle("") fxsize(125) xtitle("Mean Approval (%)", height(5)) ///
		 title("(a) Approval of U.S. Behavior") ///
		 mlabel(cond(@b<51, string(@b, "%9.0f") + "*", ///
				cond(@b<20, string(@b, "%9.0f") + "**", ///
				cond(@b<30, string(@b, "%9.0f") + "***", string(@b, "%9.0f"))))) 
					 
			 
** Sanctions
coefplot punish, ciopts(recast(rcap)) format(%9.0f) rescale(100) mlabposition(12) ///
		 ylabel("") ytitle("") fxsize(85) name(g2, replace) ///
		 xtitle("Mean Support (%)", height(5)) title("(b) Support for Sanctions") ///
		 mlabel(cond(@b<51, string(@b, "%9.0f") + "*", ///
				cond(@b<20, string(@b, "%9.0f") + "**", ///
				cond(@b<30, string(@b, "%9.0f") + "***", string(@b, "%9.0f")))))	
					 
graph combine g1 g2, scale(1.35) ycommon xcommon ///
	  l1title("Responses by the Target of Criticism", size(small)) ///
	  note("{it:Notes}: Figure 3 displays the mean approval for U.S. policy (3a) and support for sanctions (3b)" ///
		 "with accompanying 95 percent confidence intervals. The denial, unrelated, past, and recent" ///
		 "response point estimates are accompanied with an asterisk (*) if they are significantly different" ///
		 "from the “no comment” response at the p < 0.05 level.") 

					 
********************************************************************************
***** Figure 4 *****************************************************************
********************************************************************************
	
// Combined Analysis by country
quietly reg appb i.what##i.country, cluster(id)
	margins i.what, at(country=1) vsquish post
	estimates store rus
quietly reg appb i.what##i.country, cluster(id)
	margins i.what, at(country=2) vsquish post
	estimates store ger
quietly reg appb i.what##i.country, cluster(id)
	margins i.what, at(country=3) vsquish post
	estimates store tur	

coefplot rus, ciopts(recast(rcap)) format(%9.0f) rescale(100) mlabposition(12) ///
			  ylabel(1 `""Recent" "Whataboutism" "' 2 `""Past" "Whataboutism" "' ///
					 3 `""Unrelated" "Whataboutism" "' 4 "Denial" 5 "No comment", ///
					 labcol(black)) fxsize(75) /// 
			  ytitle("") xtitle("") title("(a) Russia") name(rus1, replace) ///
			  mlabel(cond(@b<50, string(@b, "%9.0fc") + "*", ///
					 cond(@b<20, string(@b, "%9.0fc") + "**", ///
					 cond(@b<30, string(@b, "%9.0fc") + "***", string(@b, "%9.0fc"))))) 

coefplot ger, ciopts(recast(rcap)) format(%9.0f) rescale(100) mlabposition(12) ///
			  ylabel("") ytitle("")  fxsize(50) ///
			  xtitle("") title("(b) Germany") name(ger1, replace) ///
			  mlabel(cond(@b<50, string(@b, "%9.0fc") + "*", ///
					 cond(@b<20, string(@b, "%9.0fc") + "**", ///
					 cond(@b<30, string(@b, "%9.0fc") + "***", string(@b, "%9.0fc")))))

coefplot tur, ciopts(recast(rcap)) format(%9.0f) rescale(100) mlabposition(12) ///
			  ylabel("") ytitle("") fxsize(50) ///
			  xtitle("") title("(c) Turkey") name(tur1, replace) ///
			  mlabel(cond(@b<41, string(@b, "%9.0fc") + "*", ///
					 cond(@b<20, string(@b, "%9.0fc") + "**", ///
					 cond(@b<30, string(@b, "%9.0fc") + "***", string(@b, "%9.0fc")))))

// Combined Analysis by country
quietly reg pun2b i.what##i.country, cluster(id)
	margins i.what, at(country=1) vsquish post
	estimates store rus
quietly reg pun2b i.what##i.country, cluster(id)
	margins i.what, at(country=2) vsquish post
	estimates store ger
quietly reg pun2b i.what##i.country, cluster(id)
	margins i.what, at(country=3) vsquish post
	estimates store tur	

coefplot rus, ciopts(recast(rcap)) format(%9.0f) rescale(100) mlabposition(12) ///
			  ylabel(1 `""Recent" "Whataboutism" "' 2 `""Past" "Whataboutism" "' ///
					 3 `""Unrelated" "Whataboutism" "' 4 "Denial" ///
					 5 "No comment", labcol(black)) fxsize(75) /// 
			  ytitle("") xtitle("") title("(d) Russia") name(rus2, replace) ///
			  mlabel(cond(@b<55, string(@b, "%9.0fc") + "*", ///
					 cond(@b<20, string(@b, "%9.0fc") + "**", ///
					 cond(@b<30, string(@b, "%9.0fc") + "***", string(@b, "%9.0fc"))))) 

coefplot ger, ciopts(recast(rcap)) format(%9.0f) rescale(100) mlabposition(12) ///
			  ylabel("") ytitle("") fxsize(50) ///
			  xtitle("") title("(e) Germany") name(ger2, replace) ///
			  mlabel(cond(@b<45, string(@b, "%9.0fc") + "*", ///
					 cond(@b<20, string(@b, "%9.0fc") + "**", ///
					 cond(@b<30, string(@b, "%9.0fc") + "***", string(@b, "%9.0fc"))))) 

coefplot tur, ciopts(recast(rcap)) format(%9.0f) rescale(100) mlabposition(12) ///
			  ylabel("") ytitle("") fxsize(50) ///
			  xtitle("") title("(f) Turkey") name(tur2, replace) ///
			  mlabel(cond(@b<49, string(@b, "%9.0fc") + "*", ///
					 cond(@b<20, string(@b, "%9.0fc") + "**", ///
					 cond(@b<30, string(@b, "%9.0fc") + "***", string(@b, "%9.0fc"))))) 

					 
graph combine rus1 ger1 tur1, ycommon xcommon rows(1) name(g1, replace) ///
	  b1title("Mean Approval of U.S. Behavior (%)", size(small))
graph combine rus2 ger2 tur2, ycommon xcommon rows(1) name(g2, replace) ///
	  b1title("Mean Support for Sanctions (%)", size(small))

graph combine g1 g2, rows(2) scale(1.20) ///
	note("{it:Notes}: Figure 4 displays respondent approval for U.S. behavior (top) and support for sanctions" ///
	     "(bottom) separated by the identity of the whataboutist actor. The denial, unrelated, past, and" ///
		 "recent response point estimates are accompanied with an asterisk (*) if they are significantly" ///
		 "different from the “no comment” response at the p < 0.05 level.") ///
					 l1("Respnses by the Target of Criticism", size(small)) ///
					 xsize(8) ysize(6) 
		  
			  	  
	
********************************************************************************
***** Figurse 8 & 9 ************************************************************
********************************************************************************
	
// Follow-up survey analyses
import delimited "followup.csv", clear varname(1)

gen what1 = (what-7)*(-1)
drop what
rename what1 what

quietly reg approve i.what if issue==1, cluster(id)
	margins i.what, vsquish post
	estimates store e1
	
quietly reg approve i.what if issue==2, cluster(id)
	margins i.what, vsquish post
	estimates store r1	
	
quietly reg pun2 i.what if issue==1, cluster(id)
	margins i.what, vsquish post
	estimates store e2
	
quietly reg pun2 i.what if issue==2, cluster(id)
	margins i.what, vsquish post
	estimates store r2		
	
coefplot e1, ///
		     citop ciopts(recast(rcap)) scheme(plottig) fxsize(120) ///
			 mlabel rescale(100) format(%9.0f) mlabcol(black) mlabpos(2) ///
			 title("(a) Election Interference") ///
			 xtitle("") ///
			 ytitle("") ///
			 ylabel(1 `" "Whataboutism" "Admission of Guilt" "' ///
				    2 `" "Whataboutism" "Democracy or" "Wider Context" "' ///
				    3 `" "Whataboutism" "Dismissal" "' ///
					4 `" "Whataboutism" "No Response" "' ///
				    5 "Denial" ///
					6 "No comment", labcol(black)) ///
			mlabel(cond(@b<50, string(@b, "%9.0fc") + "*", ///
				   cond(@b<20, string(@b, "%9.0fc") + "**", ///
				   cond(@b<30, string(@b, "%9.0fc") + "***", ///
				   string(@b, "%9.0fc"))))) name(f1, replace)

coefplot r1, ///
		   citop ciopts(recast(rcap)) scheme(plottig) mlabpos(2) fxsize(100) ///
			 mlabel rescale(100) format(%9.0f) mlabcol(black) ///
			 title("(b) Refugee Crisis") ///
			 xtitle("") ///
			 ytitle("") ///
			 ylabel("") ///
			mlabel(cond(@b<50, string(@b, "%9.0fc") + "*", ///
				   cond(@b<20, string(@b, "%9.0fc") + "**", ///
				   cond(@b<30, string(@b, "%9.0fc") + "***", ///
				   string(@b, "%9.0fc"))))) name(f2, replace)

	* Generate Figure 8
graph combine f1 f2, scale(1.25) xcommon ycommon rows(1) ///	
	  note("{it:Notes}: Figure 8 displays the mean approval of U.S. behavior based on different responses by" ///
		   "the target of U.S. criticism with accompanying rejoinders by the U.S. for electoral interference" ///
		   "(left figure) and refugee crisis (right figure) issue areas. The denial, whataboutism | no response," ///
		   "whataboutism | dismissal, whataboutism | democracy or wider context, and whataboutism | admission " ///
		   "of guilt response point estimates are accompanied with an asterisk (*) if they are significantly" ///
		   "different from the “no comment” response at the p < 0.05 level.", height(25)) ///
	  l1("Responses by Target of" "Criticism and U.S. Rejoinder", size(small) height(5)) ///
	  b1title("Mean Approval of U.S. Behavior (%)", size(small))
				  
					
coefplot e2, ///
		     ciopts(recast(rcap)) scheme(plottig) fxsize(120) ///
			 mlabel rescale(100) format(%9.0f) mlabcol(black) mlabpos(2) ///
			 title("(a) Election Interference") ///
			 xtitle("") ///
			 ytitle("") ///
			 ylabel(1 `" "Whataboutism" "Admission of Guilt" "' ///
				    2 `" "Whataboutism" "Democracy or" "Wider Context" "' ///
				    3 `" "Whataboutism" "Dismissal" "' ///
					4 `" "Whataboutism" "No Response" "' ///
				    5 "Denial" ///
					6 "No comment", labcol(black)) ///
			mlabel(cond(@b<51, string(@b, "%9.0fc") + "*", ///
				   cond(@b<20, string(@b, "%9.0fc") + "**", ///
				   cond(@b<30, string(@b, "%9.0fc") + "***", ///
				   string(@b, "%9.0fc"))))) name(f3, replace)	

coefplot r2, ///
		     citop ciopts(recast(rcap)) scheme(plottig) mlabpos(2) fxsize(90) ///
			 mlabel rescale(100) format(%9.0f) mlabcol(black) ///
			 title("(b) Refugee Crisis") ///
			 xtitle("Support for Sanctions (%)", height(5)) ///
			 ytitle("") ///
			 ylabel("") ///
			mlabel(cond(@b<50, string(@b, "%9.0fc") + "*", ///
				   cond(@b<20, string(@b, "%9.0fc") + "**", ///
				   cond(@b<30, string(@b, "%9.0fc") + "***", ///
				   string(@b, "%9.0fc"))))) name(f4, replace)


	* Generate Figure 9
graph combine f3 f4, scale(1.25) xcommon ycommon rows(1) ///	
	  note("{it:Notes}: Figure 9 displays the mean support for imposing sanctions based on different responses by" ///
		   "the target of U.S. criticism with accompanying rejoinders by the U.S. for electoral interference" ///
		   "(left figure) and refugee crisis (right figure) issue areas. The denial, whataboutism | no response," ///
		   "whataboutism | dismissal, whataboutism | democracy or wider context, and whataboutism | admission " ///
		   "of guilt response point estimates are accompanied with an asterisk (*) if they are significantly" ///
		   "different from the “no comment” response at the p < 0.05 level.", height(25)) ///
	  l1("Responses by Target of" "Criticism and U.S. Rejoinder", size(small) height(5)) ///
	  b1title("Mean Support for Sanctions (%)", size(small))
			  		  
